import http from '../utils/axios';
interface getData {
  orderId?: number;
  pageNum?: number;
  size?: number;
  state?: number;
  orderCreated?: string;
  orderState?: number;
  page?: number;
  userPhone?: string;
  appliId?: number;
  insertTime?: string;
  startUse?: number;
  reasonDescription?: string;
  salesType?: number;
}

// 获取所有订单信息
// export const getOrderAll=(params:getData)=>{
//     return http<any>({
//         method:'get',
//         url:'/order/selectAll',
//         params
//     })
// }

// 管理员根据订单状态查询所有订单
export const getOrderByState = (params: getData) => {
  return http.get<any>('/other/order/selecByState', params);
};

//  管理员根据条件查询订单
export const getOrderByCondition = (data: getData) => {
  return http.post<any>('/other/order/selecByCondition', data);
};

// 根据订单编号查询订单详情信息
export const getOrderDetailById = (params: getData) => {
  return http.get<any>('/other/order/selectByOrderId', params);
};

// 根据商品id和订单编号查询商品规格信息
export const getGoodsById = (data: any) => {
  return http.post<any>('/other/order/selectByGoodsVo', data);
};

// 根据订单编号关闭订单
export const closeOrderById = (params: getData) => {
  return http.post<any>('/other/order/closeOrder', params);
};

// 根据订单编号确认订单
export const confirmOrderById = (params: getData) => {
  return http.post<any>('/other/order/confimOrder', params);
};

// 查询订单设置 /order/selectOrderSetting
export const getOrderSet = () => {
  return http.get<any>('/other/order/selectOrderSetting');
};

// 根据订单编号设置订单
export const setOrderTime = (data: any) => {
  return http.post<any>('/other/order/orderSetTime', data);
};

//根据订单编号修改联系人信息
export const setUserInfoByOrder = (data: any) => {
  return http.post<any>('/other/order/updateByOrderId', data);
};
// 根据商品规格id和商品数量进行更新订单信息
export const setOrderBySku = (data: any) => {
  return http.post<any>('/other/order/updateBySku', data);
};

/////////////////////////////
// 退换原因设置
export const getAllReason = (params: getData) => {
  return http.get<any>('/other/aftereason/selectAllReason', params);
};

// 管理员添加退换原因/aftereason/InsertAftereason
export const addReason = (data: getData) => {
  return http.post<any>('/other/aftereason/InsertAftereason', data);
};

// interface DelReason{
//     id:any
// }
// /aftereason/deleteAftereasonList管理员删除退换原因
export const delReason = (data: any) => {
  return http.post<any>('/other/aftereason/deleteAftereasonList', data);
};

// /aftereason/updateStateList 管理员修改退换原因启用状态
export const updateReasonState = (data: any) => {
  return http.post<any>('/other/aftereason/updateStateList', data);
};

// /aftereason/updateAftereason 管理员修改退换原因
export const updateReason = (data: any) => {
  return http.post<any>('/other/aftereason/updateAftereason', data);
};

// /aftermarket/selectAll  管理员查询所有售后列表
export const getRefundAll = (params: getData) => {
  return http.get<any>('/other/aftermarket/selectAll', params);
};

// 根据订单编号查询售后详情/aftermarket/selectAftermarketByOrderId
export const getRefundById = (params: getData) => {
  return http.get<any>('/other/aftermarket/selectAftermarketByOrderId', params);
};

// 管理员处理售后情况 /aftermarket/insertHandlingOpinions

export const setRefundRes = (data: any) => {
  return http.post<any>('/other/aftermarket/insertHandlingOpinions', data);
};

// 管理员根据条件筛选售后列表 /aftermarket/selectCondition
export const getByCondition = (data: any) => {
  return http.post<any>('/other/aftermarket/selectCondition', data);
};
